"""
@created 2025-09-27
@Author sgzeng
@Des 基本配置文件
"""
import os.path

from dotenv import find_dotenv, load_dotenv
from pydantic import BaseSettings
from typing import List

class Config(BaseSettings):
    # 加载环境变量
    load_dotenv(find_dotenv(), override=True)
    # 调试模式
    APP_DEBUG: bool = True
    # 项目信息
    VERSION: str = "0.0.1"
    PROJECT_NAME: str = 'basic_fastapi'
    DESCRIPTION: str = 'FastAPI基础项目'
    # 静态资源目录
    STATIC_DIR: str = os.path.join(os.getcwd(), 'static')
    TEMPLATE_DIR: str = os.path.join(STATIC_DIR,"templates")
    # 跨域请求
    CORS_ORIGINS: List[str] = ['*']
    CORS_ALLOW_CREDENTIALS: bool = True
    CORS_ALLOW_METHODS: List[str] = ['*']
    CORS_ALLOW_HEADERS: List[str] = ['*']
    # session
    SECRET_KEY = "session"
    SESSION_COOKIE = "session_id"
    SESSION_MAX_AGE = 14 * 24 * 60 * 60

settings = Config()
